package euclid;

/**
 * Interface definition: Coordinator.
 * 
 * @author OpenORB Compiler
 */
public class _CoordinatorStub extends org.omg.CORBA.portable.ObjectImpl
        implements Coordinator
{
    static final String[] _ids_list =
    {
        "IDL:euclid/Coordinator:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = euclid.CoordinatorOperations.class;

    /**
     * Operation getStarterList
     */
    public euclid.Starter[] getStarterList()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("getStarterList",true);
                    _input = this._invoke(_output);
                    euclid.Starter[] _arg_ret = euclid.starterListHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("getStarterList",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    return _self.getStarterList();
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation startGcdCalculation
     */
    public void startGcdCalculation(int minNumberProcess, int maxNumberProcess, int minDelay, int maxDelay, int timeout, int gcd)
        throws euclid.CoordinatorPackage.exInvalidParameter, euclid.CoordinatorPackage.exNoStarter
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("startGcdCalculation",true);
                    _output.write_long(minNumberProcess);
                    _output.write_long(maxNumberProcess);
                    _output.write_long(minDelay);
                    _output.write_long(maxDelay);
                    _output.write_long(timeout);
                    _output.write_long(gcd);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(euclid.CoordinatorPackage.exInvalidParameterHelper.id()))
                    {
                        throw euclid.CoordinatorPackage.exInvalidParameterHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(euclid.CoordinatorPackage.exNoStarterHelper.id()))
                    {
                        throw euclid.CoordinatorPackage.exNoStarterHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("startGcdCalculation",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.startGcdCalculation( minNumberProcess,  maxNumberProcess,  minDelay,  maxDelay,  timeout,  gcd);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation endCalculation
     */
    public void endCalculation(int result)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("endCalculation",true);
                    _output.write_long(result);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("endCalculation",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.endCalculation( result);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation logClient
     */
    public void logClient(euclid.Client client)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("logClient",true);
                    euclid.ClientHelper.write(_output,client);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("logClient",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.logClient( client);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation logMonitor
     */
    public void logMonitor(monitor.Monitor monitor)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("logMonitor",true);
                    euclid.MonitorHelper.write(_output,monitor);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("logMonitor",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.logMonitor( monitor);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation logStarter
     */
    public void logStarter(euclid.Starter starter)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("logStarter",true);
                    euclid.StarterHelper.write(_output,starter);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("logStarter",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.logStarter( starter);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation logProcess
     */
    public void logProcess(String starter, int id)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("logProcess",true);
                    _output.write_string(starter);
                    _output.write_long(id);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("logProcess",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.logProcess( starter,  id);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation endSystem
     */
    public void endSystem()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("endSystem",true);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("endSystem",_opsClass);
                if (_so == null)
                   continue;
                euclid.CoordinatorOperations _self = (euclid.CoordinatorOperations) _so.servant;
                try
                {
                    _self.endSystem();
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
